import React ,{Component} from 'react';
import Header from '../Header';
import { connect } from 'react-redux';
import { bindActionCreators } from 'redux';
import { detailActions } from './store';

const { getDetailShow }  = detailActions;

class Detail extends Component{

    constructor(props,context){
        super(props,context);
        this.state = {
            hasError:false,
        }
    }

    componentDidMount(){
        this.props.getDetailShow('5c514458c05538428e0e790d');

    }

    render() {

        return (
            <div >
                <Header/>
                {this.props.detail.articleTitle}
            </div>
        )
    }
}


const mapStateToProps=(state)=>({
    detail:{...state.detail}
});

const mapDispatchToProps=(dispatch)=>bindActionCreators({
    getDetailShow: getDetailShow,
},dispatch);

export default connect(mapStateToProps,mapDispatchToProps)(Detail)